<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Perform socket actions</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="httprequestpool.send.html">HttpRequestPool::send</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="httprequestpool.socketselect.html">HttpRequestPool::socketSelect</a></div>
 <div class="up"><a href="class.httprequestpool.html">HttpRequestPool</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="httprequestpool.socketperform" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">HttpRequestPool::socketPerform</h1>
  <p class="verinfo">(PECL pecl_http &gt;= 0.15.0)</p><p class="refpurpose"><span class="refname">HttpRequestPool::socketPerform</span> &mdash; <span class="dc-title">Perform socket actions</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-httprequestpool.socketperform-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">protected</span>
   <span class="type">bool</span> <span class="methodname"><strong>HttpRequestPool::socketPerform</strong></span>
    ( <span class="methodparam">void</span>
   )</div>


  <p class="para rdfs-comment">
   Returns <strong><code>TRUE</code></strong> until each request has finished its transaction.
  </p>

 </div>

 <div class="refsect1 returnvalues" id="refsect1-httprequestpool.socketperform-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> until each request has finished its transaction.
  </p>
 </div>


 


 


 <div class="refsect1 examples" id="refsect1-httprequestpool.socketperform-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4262">
    <p><strong>Example #1 A <span class="function"><strong>HttpRequestPool::socketPerform()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">MyPool&nbsp;</span><span style="color: #007700">extends&nbsp;</span><span style="color: #0000BB">HttpRequestPool<br /></span><span style="color: #007700">{<br />&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">send</span><span style="color: #007700">()<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socketPerform</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socketSelect</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;</span><span style="color: #0000BB">HttpSocketExcpetion</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;final&nbsp;function&nbsp;</span><span style="color: #0000BB">socketPerform</span><span style="color: #007700">()<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">parent</span><span style="color: #007700">::</span><span style="color: #0000BB">socketPerform</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getFinishedRequests</span><span style="color: #007700">()&nbsp;as&nbsp;</span><span style="color: #0000BB">$r</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">detach</span><span style="color: #007700">(</span><span style="color: #0000BB">$r</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;handle&nbsp;response&nbsp;of&nbsp;finished&nbsp;request<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>



 


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="httprequestpool.send.html">HttpRequestPool::send</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="httprequestpool.socketselect.html">HttpRequestPool::socketSelect</a></div>
 <div class="up"><a href="class.httprequestpool.html">HttpRequestPool</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
